<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>地图参数</title>
    <!-- 1、引入资源 -->
    <script type="text/javascript">
        window._AMapSecurityConfig = {
          securityJsCode:"ec8990c1cac6e2f42866a4f908a19989",
        }
      </script>
      <script type="text/javascript"
      src="https://webapi.amap.com/maps?v=2.0&key=1d8c4c24f36ffedf82812d42f9835ac9"></script>
      
    <!-- 3、定义容器 -->
    <style>
        body,html,#container{
            width: 100%;
            height: 100%;
        }
    </style>
</head>
<body>
    <button onclick="add()">显示实时路况</button>
    <button onclick="remove()">隐藏实时路况</button>
    <button onclick="up()">+</button>

    <div id="container"></div>
    <!-- 2、创建容器 -->
    <!-- 4、加载地图 -->
    <script>
        var map= new AMap.Map('container',{center:[114,30],
        zoom:10,
        viewMode:'3D' ,
        pitch:45   
        }) 
        var traffic=new AMap.TileLayer.Traffic({
            'autoRefresh':true,
            'interval':180,
        });
        function add()
        {
            map.add(traffic)
        }
        function remove()
        {
            map.remove(traffic)
        }
        function up()
        {
            map.pitch+=10;
        }
    </script>
</body>
</html>